﻿using System;
using System.Collections.Generic;
using System.Text;
using Ixtli.PAL;

namespace Ixtli.Kernel.PAL
{
	/// <summary>
	/// General interface for platform-specific functionality used exclusively by the kernel.
	/// </summary>
	public interface IKernelPAL : IPAL
	{
		/// <summary>
		/// Startup the platform services.
		/// </summary>
		/// <param name="parameters">Startup parameters. Use <c>null</c> for default settings.</param>
		/// <returns>The result of the startup operation.</returns>
		PalStartupResult Startup( PalStartupParameters parameters );

		/// <summary>
		/// Shutdown the platform services.
		/// </summary>
		/// <param name="mode">The mode to shutdown the system in.</param>
		/// <param name="argument">The mode-specific argument. Use <c>null</c> for the default.</param>
		/// <returns>The result of the shutdown operation.</returns>
		PalShutdownResult Shutdown( PalShutdownMode mode, int? argument );

		/// <summary>
		/// Yield processing to the platform.
		/// </summary>
		void Yield();
	}

	/// <summary>
	/// Defines the results of a <c>Startup</c> command.
	/// </summary>
	public enum PalStartupResult
	{
		/// <summary>
		/// Startup completed successfully.
		/// </summary>
		Success,
	}

	/// <summary>
	/// Generalized parameters for PAL <c>Startup</c> command.
	/// </summary>
	public class PalStartupParameters
	{
	}

	/// <summary>
	/// Defines the results of a <c>Shutdown</c> command.
	/// </summary>
	public enum PalShutdownResult
	{
		/// <summary>
		/// Shutdown completed successfully.
		/// </summary>
		Success,
		/// <summary>
		/// A module denied the shutdown request.
		/// </summary>
		Denied,
	}

	/// <summary>
	/// Defines the possible <c>Shutdown</c> modes.
	/// </summary>
	public enum PalShutdownMode
	{
		/// <summary>
		/// Shutdown after all modules have cleaned up. <c>argument</c> specifies a maximum time to wait.
		/// </summary>
		Normal,
		/// <summary>
		/// Shutdown immediately (unsafe) - does not execute any module shutdowns.
		/// </summary>
		Immediate,
	}
}
